import java.util.Arrays;
import java.util.Scanner;

public class Test {

    public static void twoSum(int[] nums, int target ) {
        int[] array = new int[2];
        for (int i = 0; i < nums.length; i++) {
            for (int j = nums.length - 1; j > i; j--) {
                if (nums[i] + nums[j] == target) {
                    array[0] = i;
                    array[1] = j;
                    break;
                }

            }
        }
        System.out.println(Arrays.toString(array));
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("输入几个数：");
        int n = scanner.nextInt();
        System.out.println("目标值：");
        int target = scanner.nextInt();
        System.out.println("输入数组：");
        int[] nums = new int[n];
        for (int i = 0; i < n; i++) {
            nums[i] = scanner.nextInt();
        }

        Arrays.sort(nums);

        twoSum(nums, target );

    }
}


